package com.mit.web.business;

import com.mit.common.RequestContext;
import com.mit.common.ResultContext;
import com.mit.common.exception.BaseException;
import com.mit.common.security.dto.UserDTO;
import com.mit.common.token.SecurityTokens;

public class SecurityService extends RemoteService{
	
	private final String FACADE_NAME = "SecurityFacade";
	@Override
	public String getFacadeName() {
		return FACADE_NAME;
	}
	
	public UserDTO retrieveUserByNamePwd(String username, String password, UserDTO currentUser) throws BaseException{
		RequestContext rqs = this.createRequestContext("retrieveUserByNamePwd", currentUser);
		rqs.addParameter(SecurityTokens.KEY_USERNAME, username);
		rqs.addParameter(SecurityTokens.KEY_PASSWORD, password);
		ResultContext rlt = ServiceLocator.getInstance().doBusiness(rqs);
		UserDTO user = (UserDTO) rlt.getResult(SecurityTokens.KEY_USER_DTO);
		return user;
	}
}
